<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script type="text/javascript">
    //作业1：
	//写一个函数，格式化时间 formatDate(),参数可以是字符串，也可以是时间对象。
	//效果： 2021-10-05 15：15：09 星期几
    
    function formatDate(){
        let Time = new Date();

        let nYear =Time.getFullYear();
        let nMonth =Time.getMonth()+1;
        let nDate =Time.getDate() ;
        let nDay =Time.getDay() ;
        let nHours =Time. getHours();
        let nMinutes =Time.getMinutes();
        let nSeconds =Time.getSeconds();
        

        let ThisTime = `${nYear}-${nMonth}-${nDate} ${nHours}:${nMinutes}:${nSeconds} 星期${nDay}`
        return ThisTime

    }
    console.log(formatDate());

    </script>

</body>
</html>